import { getAction, postAction, deleteAction } from '@/api/baseAPI'

/** 商品分类 */
// 查询商品分类树
export const apiQueryCommodityVarietyTree = params => getAction('/back/commodity-variety/tree', params)
// 保存商品分类信息
export const apiSaveCommodityVariety = params => postAction('/back/commodity-variety/save', params)
// 删除商品分类信息
export const apiDelCommodityVariety = id => getAction('/back/commodity-variety/del/' + id)

/** 商品信息 */
// 分页查询商品信息列表
export const apiQueryCommodityList = params => getAction('/back/commodity/page', params)
// 上架商品
export const apiReleaseCommodity = id => postAction('/back/commodity/release/' + id)
// 下架商品
export const apiUnreleasedCommodity = id => postAction('/back/commodity/unreleased/' + id)
// 还原商品
export const apiRestoreCommodity = id => postAction('/back/commodity/restore/' + id)
// 按id查询商品信息
export const apiQueryCommodityById = id => getAction('/back/commodity/' + id)
// 保存商品
export const apiSaveCommodity = params => postAction('/back/commodity/save', params)
// 更新商品
export const apiUpdateCommodity = (id, params) => postAction('/back/commodity/update/' + id, params)
// 批量删除商品
export const apiDelBatchCommodity = params => deleteAction('/back/commodity/batch', params)
// 分页查询回收站的商品信息列表
export const apiQueryRecycleCommodityList = params => getAction('/back/commodity/recycle/page', params)

/** 商品日志 */
// 按商品id查询商品的操作日志
export const apiQueryCommodityLogList = (commodityId, params) => getAction('/back/commodity-log/page/' + commodityId, params)
